

package cn.nubia.admin.application.bean;

import cn.nubia.admin.common.mybatis.annotations.Column;
import cn.nubia.admin.common.mybatis.annotations.Id;
import cn.nubia.admin.common.mybatis.annotations.Table;
import cn.nubia.admin.common.mybatis.annotations.UnColumn;
import cn.nubia.admin.common.utils.DateUtil;
import org.hibernate.validator.constraints.NotEmpty;

import java.io.Serializable;
import java.util.Date;
import java.util.Map;
import java.util.TreeMap;

/**
 * Created by justin on 15/6/30.
 * CREATE TABLE `nb_notify_push` (
 `msg_id` int(11) NOT NULL COMMENT '消息编号',
 `msg_title` varchar(50) DEFAULT NULL COMMENT '消息标题',
 `msg_descript` varchar(3000) DEFAULT NULL COMMENT '消息简介',
 `msg_obj` smallint(6) DEFAULT NULL COMMENT '消息对象（1：Store 2：App 3： 专题 4：分类 5：外链）',
 `msg_show_type` smallint(6) DEFAULT NULL COMMENT '消息展示方式（1：普通 2：Banner）',
 `begin_time` int(11) DEFAULT NULL COMMENT '开始时间',
 `end_time` int(11) DEFAULT NULL COMMENT '结束时间',
 `is_loop_push` tinyint(4) DEFAULT NULL COMMENT '是否循环推送',
 `loop_cycle` int(11) DEFAULT NULL COMMENT '循环周期(0、不循环；1、每天；2、每周；3、每月；4、工作日)',
 `push_time_point` varchar(10) DEFAULT NULL COMMENT '循环推送时间点',
 `pic_url` varchar(250) DEFAULT NULL COMMENT 'banne图地址',
 `icon_url` varchar(250) DEFAULT NULL COMMENT '普通展示图标地址',
 `state` smallint(6) DEFAULT NULL COMMENT '状态（-1：删除，0：正常）',
 `is_full_screen` tinyint(4) DEFAULT NULL COMMENT '是否全屏',
 `full_screen_image` varchar(250) DEFAULT NULL COMMENT '全屏推广图',
 `res_id` int(11) DEFAULT NULL COMMENT '资源Id',
 `link_url` varchar(250) DEFAULT NULL COMMENT '外部链接',
 `create_time` int(11) DEFAULT NULL COMMENT '创建时间(时间戳)',
 `create_admin_id` int(11) DEFAULT NULL COMMENT '添加的管理员id',
 `last_modify_time` int(11) DEFAULT NULL COMMENT '最后修改时间(时间戳)',
 `create_admin_name` varchar(50) DEFAULT NULL COMMENT '创建人的管理员名称',
 PRIMARY KEY (`msg_id`)
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='消息推送';

 msg_title   msg_descript  msg_show_type  begin_time  is_loop_push loop_cycle  pic_url, icon_url
 */
@Table(value = "nb_notify_push")
public class NotifyPush implements Serializable{

    private static final long serialVersionUID = -8244661101951482489L;

    public static final int STATE_MSGSHOWTYPE_NORMAL=1;
    public static final int STATE_MSGSHOWTYPE_BANNER=2;

    public static final int MSGOBJ_APP=2;
    public static final int MSGOBJ_TOPIC=3;
    public static final int MSGOBJ_CATETORY=4;
    public static final int MSGOBJ_LINKURL=5;

    public static final int STATE_NORMAL = 0;
    public static final int STATE_DEL = -1;


    public static final String COLUMN_MSGOBJ = "msgObj";
    public static final String COLUMN_BEGINTIME = "beginTime";
    public static final String COLUMN_STATE = "state";

    public static Map<String,String> msgObjMap = new TreeMap<>();
    static {
        msgObjMap.put("2","软件");
        msgObjMap.put("3","专题");
        msgObjMap.put("4","分类");
        msgObjMap.put("5","外链");
    }



    @Id(value = "msg_id")
    private Integer id;
    @NotEmpty(message = "{notifypush.msgTitle.null}")
    @Column(value = "msg_title")
    private String msgTitle;//消息标题
    @NotEmpty(message = "{notifypush.msgDescript.null}")
    @Column(value = "msg_descript")
    private String msgDescript;//消息简介
    @Column(value = "msg_obj")
    private Integer msgObj;//消息对象（2：App 3： 专题 4：分类 5：外链）
    @Column(value = "msg_show_type")
    private Integer msgShowType;//消息展示方式（1：普通 2：Banner）
    @Column(value = "begin_time")
    private Integer beginTime;
    @Column(value = "end_time")
    private Integer endTime;
    @Column(value = "is_loop_push")
    private Integer isLoopPush;
    @Column(value = "loop_cycle")
    private Integer loopCycle;//循环周期(0、不循环；1、每天；2、每周；3、每月；4、工作日)
    @Column(value = "push_time_point")
    private String pushTimePoint;//循环推送时间点
    @Column(value = "pic_url")
    private String picUrl;//banne图地址
    @Column(value = "icon_url")
    private String iconUrl;//普通展示图标地址
    @Column(value = "state")
    private Integer state;//状态（-1：删除，0：正常）
    @Column(value = "is_full_screen")
    private Integer isFullScreen;//是否全屏
    @Column(value = "full_screen_image")
    private String fullScreenImage;//全屏推广图
    @Column(value = "res_id")
    private Integer resId;//资源Id
    @Column(value = "link_url")
    private String linkUrl;//外部链接
    @Column(value = "create_time")
    private Integer createTime;
    @Column(value = "create_admin_id")
    private Integer createAdminId;
    @Column(value = "last_modify_time")
    private Integer lastModifyTime;
    @Column(value = "create_admin_name")
    private String createAdminName;
    @UnColumn
    private Date beginDate;
    @UnColumn
    private Date endDate;
    @UnColumn
    private Integer softradio;
    @UnColumn
    private Integer categoryradio;
    @UnColumn
    private Integer topicradio;
    @UnColumn
    private String msgObjShow;
    @UnColumn
    private String beginStr;
    @UnColumn
    private String endStr;
    @UnColumn
    private String createTimeShow;
    @UnColumn
    private String lastModifyTimeShow;



    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getMsgTitle() {
     return msgTitle;
    }

    public void setMsgTitle(String msgTitle) {
     this.msgTitle = msgTitle;
    }

    public String getMsgDescript() {
     return msgDescript;
    }

    public void setMsgDescript(String msgDescript) {
     this.msgDescript = msgDescript;
    }

    public Integer getMsgObj() {
     return msgObj;
    }

    public void setMsgObj(Integer msgObj) {
     this.msgObj = msgObj;
    }

    public Integer getMsgShowType() {
     return msgShowType;
    }

    public void setMsgShowType(Integer msgShowType) {
     this.msgShowType = msgShowType;
    }

    public Integer getBeginTime() {
     return beginTime;
    }

    public void setBeginTime(Integer beginTime) {
     this.beginTime = beginTime;
    }

    public Integer getEndTime() {
     return endTime;
    }

    public void setEndTime(Integer endTime) {
     this.endTime = endTime;
    }

    public Integer getIsLoopPush() {
     return isLoopPush;
    }

    public void setIsLoopPush(Integer isLoopPush) {
     this.isLoopPush = isLoopPush;
    }

    public Integer getLoopCycle() {
     return loopCycle;
    }

    public void setLoopCycle(Integer loopCycle) {
     this.loopCycle = loopCycle;
    }

    public String getPushTimePoint() {
     return pushTimePoint;
    }

    public void setPushTimePoint(String pushTimePoint) {
     this.pushTimePoint = pushTimePoint;
    }

    public String getPicUrl() {
     return picUrl;
    }

    public void setPicUrl(String picUrl) {
     this.picUrl = picUrl;
    }

    public String getIconUrl() {
     return iconUrl;
    }

    public void setIconUrl(String iconUrl) {
     this.iconUrl = iconUrl;
    }

    public Integer getState() {
     return state;
    }

    public void setState(Integer state) {
     this.state = state;
    }

    public Integer getIsFullScreen() {
        return isFullScreen;
    }

    public void setIsFullScreen(Integer isFullScreen) {
        this.isFullScreen = isFullScreen;
    }

    public String getFullScreenImage() {
     return fullScreenImage;
    }

    public void setFullScreenImage(String fullScreenImage) {
     this.fullScreenImage = fullScreenImage;
    }

    public Integer getResId() {
     return resId;
    }

    public void setResId(Integer resId) {
     this.resId = resId;
    }

    public String getLinkUrl() {
     return linkUrl;
    }

    public void setLinkUrl(String linkUrl) {
     this.linkUrl = linkUrl;
    }

    public Integer getCreateTime() {
     return createTime;
    }

    public void setCreateTime(Integer createTime) {
     this.createTime = createTime;
    }

    public Integer getCreateAdminId() {
     return createAdminId;
    }

    public void setCreateAdminId(Integer createAdminId) {
     this.createAdminId = createAdminId;
    }

    public Integer getLastModifyTime() {
     return lastModifyTime;
    }

    public void setLastModifyTime(Integer lastModifyTime) {
     this.lastModifyTime = lastModifyTime;
    }

    public String getCreateAdminName() {
     return createAdminName;
    }

    public void setCreateAdminName(String createAdminName) {
     this.createAdminName = createAdminName;
    }

    public Date getBeginDate() {
        return beginDate;
    }

    public void setBeginDate(Date beginDate) {
        this.beginDate = beginDate;
        if(this.beginDate!=null)
            this.setBeginTime(DateUtil.getIntegerTime(beginDate));
    }

    public Date getEndDate() {
        return endDate;
    }

    public void setEndDate(Date endDate) {
        this.endDate = endDate;
        if(this.endDate != null)
            this.setEndTime(DateUtil.getIntegerTime(endDate));
    }

    public Integer getSoftradio() {
        return softradio;
    }

    public void setSoftradio(Integer softradio) {
        this.softradio = softradio;
    }

    public Integer getCategoryradio() {
        return categoryradio;
    }

    public void setCategoryradio(Integer categoryradio) {
        this.categoryradio = categoryradio;
    }

    public Integer getTopicradio() {
        return topicradio;
    }

    public void setTopicradio(Integer topicradio) {
        this.topicradio = topicradio;
    }

    public String getMsgObjShow() {
        return msgObjShow;
    }

    public void setMsgObjShow(String msgObjShow) {
        this.msgObjShow = msgObjShow;
    }

    public String getBeginStr() {
        return beginStr;
    }

    public void setBeginStr(String beginStr) {
        this.beginStr = beginStr;
    }

    public String getEndStr() {
        return endStr;
    }

    public void setEndStr(String endStr) {
        this.endStr = endStr;
    }

    public String getCreateTimeShow() {
        return createTimeShow;
    }

    public void setCreateTimeShow(String createTimeShow) {
        this.createTimeShow = createTimeShow;
    }

    public String getLastModifyTimeShow() {
        return lastModifyTimeShow;
    }

    public void setLastModifyTimeShow(String lastModifyTimeShow) {
        this.lastModifyTimeShow = lastModifyTimeShow;
    }
}
